package lambdaDemo;

import reflectDemo.Student;

import java.util.PriorityQueue;

//无返回值，无参数
@FunctionalInterface
interface NoParameterNoReturn{
    void test();
}
interface OneParameterNoReturn{
    void test(int a);
}
interface MoreParameterNoReturn{
    void test(int a,int b);
}
interface NoParameterReturn{
    int test();
}
interface OneParameterReturn{
    int test(int a);
}
interface MoreParameterReturn{
    int test(int a,int b);
}
public class Test {
    public static void main(String[] args) {
        PriorityQueue<Integer> priorityQueue=new PriorityQueue<>(((o1, o2) -> o1-o2));
        //new了一个匿名内部类
        NoParameterNoReturn noParameterNoReturn =new NoParameterNoReturn() {
            @Override
            public void test() {
                System.out.println("test.....");
            }
        };
        noParameterNoReturn.test();
        System.out.println("================");//没有参数      函数体
        NoParameterNoReturn noParameterNoReturn1=()-> System.out.println("test.....");
        noParameterNoReturn1.test();
        OneParameterNoReturn oneParameterNoReturn=(x)-> System.out.println("digit is"+" "+x);
        oneParameterNoReturn.test(5);
        MoreParameterNoReturn moreParemeterNoReturn=( x, y )-> System.out.println(x+y);
        moreParemeterNoReturn.test(5,3);
        NoParameterReturn noParameterReturn=()->{return 10;};
        System.out.println(noParameterReturn.test());
        OneParameterReturn oneParameterReturn=(a)->{return a;};
        System.out.println(oneParameterReturn.test(7));
        MoreParameterReturn moreParameterReturn=(x,y)->{return x+y;};
        System.out.println(moreParameterReturn.test(5, 7));


    }

}
